#ifndef SNAPSHOTSETTINGDIALOG_H
#define SNAPSHOTSETTINGDIALOG_H

#if defined(Viewer3DAPI_SnapShotSetting)
#  define Viewer3DAPI_EXPORT Q_DECL_EXPORT
#else
#  define Viewer3DAPI_EXPORT
#endif

#include <QDialog>
#include <QRegularExpressionValidator>

#include <unordered_map>
#include <optional>

namespace Ui {
class SnapShotSettingDialog;
}

enum class ImageFormat
{
    PNG,
    JPEG,
    TIFF
};

class Viewer3DAPI_EXPORT SnapShotSettingDialog : public QDialog
{
    Q_OBJECT

public:
    explicit SnapShotSettingDialog(QWidget *parent = nullptr);
    ~SnapShotSettingDialog();

public:
    QString getFileName() const;
    QString getFileFormat() const;
    qsizetype getResWidth() const;
    qsizetype getResHeight() const;
    std::vector<std::string> getSupportedFormats() const;
    std::optional<ImageFormat> getFormatFromString(const std::string& formatStr) const;
    std::string getStringFromFormat(ImageFormat format) const;

private:
    // 枚举到字符串的映射
    const std::unordered_map<ImageFormat, std::string> formatToString = {
        {ImageFormat::PNG, "PNG"},
        {ImageFormat::JPEG, "JPG"},
        {ImageFormat::TIFF, "TIFF"}
    };

    // 字符串到枚举的映射
    const std::unordered_map<std::string, ImageFormat> stringToFormat = {
        {"PNG", ImageFormat::PNG},
        {"JPG", ImageFormat::JPEG},
        {"JPEG", ImageFormat::JPEG}, // 支持两种写法
        {"TIFF", ImageFormat::TIFF}
    };

private:
    void initUI();

private:
    Ui::SnapShotSettingDialog *ui;
};

#endif // SNAPSHOTSETTINGDIALOG_H
